<?php
/**
 * PsiFramework
 *
 * Php Simple Framework
 *
 * PHP version 5.3
 *
 * @category  PsiFramework.Plugins.Shop.Classes.Model
 * @package   PsiFramework.Plugins.Shop.Classes.Model
 * @author    Remi San <remi.san@gmail.com>
 * @copyright 2011 Remi San
 * @license   http://creativecommons.org/licenses/by/3.0/  Creative Commons CC BY 3.0
 * @version   SVN: <svn_id>
 * @link      http://www.psiframework.com/phpdoc/classes/db_\PsiFramework\Plugins\Shop\Classes\Model\OrderItemLink.html
 */

namespace PsiFramework\Plugins\Shop\Classes\Model;

import("Classes.Model.Object");
import("Classes.Util.Parameters.ObjectParameters");

use \PsiFramework\Classes\Model\Object;
use \PsiFramework\Classes\Util\Parameters\ObjectParameters;
use \PsiFramework\Plugins\Shop\Classes\Model\Tax;

/**
 * The OrderItemLink Object
 *
 * This is the class for the OrderItemLink Object
 *
 * @category PsiFramework.Plugins.Shop.Classes.Model
 * @package  PsiFramework.Plugins.Shop.Classes.Model
 * @author   Remi San <remi.san@gmail.com>
 * @license  http://creativecommons.org/licenses/by/3.0/  Creative Commons CC BY 3.0
 * @link     http://www.psiframework.com/phpdoc/classes/db_\PsiFramework\Plugins\Shop\Classes\Model\OrderItemLink.html
 */
class OrderItemLink extends Object
{

    /**
     * @var Order
     */
    protected /*Order*/              $_order ;
    
    /**
     * @var OrderItem
     */
    protected /*OrderItem*/          $_item ;
    
    /**
     * @var int
     */
    protected /*int*/                $_quantity ;
    
    /**
     * @var double
     */
    protected /*double*/             $_price ;
    
    /**
     * @var double
     */
    protected /*double*/             $_discount ;
    
    /**
     * @var double
     */
    protected /*double*/             $_total ;
    
    /**
     * @var string
     */
    protected /*string*/             $_itemName ;
    
    /**
     * @var string
     */
    protected /*string*/             $_itemDetails ;
    
    /**
     * @var string
     */
    protected /*string*/             $_itemSubtext ;
    
    /**
     * @var OrderItemLinkTax[]
     */
    protected /*OrderItemLinkTax[]*/ $_taxes ;
    
    /**
     * Constructor
     * 
     * @param Order              $order       The order
     * @param OrderItem          $item        The item
     * @param int                $quantity    The quantity
     * @param double             $price       The price
     * @param double             $discount    The total discount
     * @param double             $total       The total
     * @param string             $itemName    The tax
     * @param string             $itemSubtext The tax
     * @param OrderItemLinkTax[] $taxes       The taxes
     * 
     * @return OrderItemLink
     */
    public function __construct(
        /*Order*/              $order=null,
        /*OrderItem*/          $item=null,
        /*int*/                $quantity=1,
        /*double*/             $price=null,
        /*double*/             $discount=null,
        /*double*/             $total=null,
        /*string*/             $itemName=null,
        /*string*/             $itemSubtext=null,
        /*OrderItemLinkTax[]*/ $taxes=null
    )
    {
        $this->_order = $order;
        $this->_item = $item;
        $this->_quantity = $quantity;
        $this->_price = $price;
        $this->_discount = $discount;
        $this->_total = $total;
        $this->_itemName = $itemName;
        $this->_itemDetails = null;
        $this->_itemSubtext = $itemSubtext;
        $this->_taxes = $taxes;
    }

    /**
     * Getter for the id / primary key
     *
     * @see Object::getId()
     *
     * @return array
     */
    public function getId()
    {
        if (is_null($this->_order) && is_null($this->_item)) {
        	return null ;
        } else {
        	$id = array();
        	if (!is_null($this->_order)) {
        		$id["order"] = $this->_order ;
        	}
        	if (!is_null($this->_item)) {
        		$id["item"] = $this->_item ;
        	}
        	return $id ;
        }
    }

    /**
     * Getter for the order
     *
     * @return Order
     */
    public function getOrder()
    {
    	return $this->_order ;
    }
    
    /**
     * Setter for the order
     *
     * @param Order $order The order
     *
     * @return void
     */
    public function setOrder(/*Order*/ $order)
    {
    	$this->_order = $order ;
    }
    
    /**
     * Getter for the item
     *
     * @return OrderItem
     */
    public function getItem()
    {
    	return $this->_item ;
    }
    
    /**
     * Setter for the item
     *
     * @param OrderItem $item The item
     *
     * @return void
     */
    public function setItem(/*OrderItem*/ $item)
    {
    	$this->_item = $item ;
    }
    
    /**
     * Getter for the quantity
     *
     * @return int
     */
    public function getQuantity()
    {
    	return $this->_quantity ;
    }
    
    /**
     * Setter for the quantity
     *
     * @param int $quantity The quantity
     *
     * @return void
     */
    public function setQuantity(/*int*/ $quantity)
    {
    	$this->_quantity = $quantity ;
    }
    
    /**
     * Getter for the price
     *
     * @return double
     */
    public function getPrice()
    {
    	return $this->_price ;
    }
    
    /**
     * Setter for the price
     *
     * @param double $price The price
     *
     * @return void
     */
    public function setPrice(/*double*/ $price)
    {
    	$this->_price = $price ;
    }
    
    /**
     * Getter for the discount
     *
     * @return double
     */
    public function getDiscount()
    {
    	return $this->_discount ;
    }
    
    /**
     * Setter for the discount
     *
     * @param double $discount The discount
     *
     * @return double
     */
    public function setDiscount(/*double*/ $discount)
    {
    	$this->_discount = $discount ;
    }
    
    /**
     * Getter for the total
     *
     * @return double
     */
    public function getTotal()
    {
    	return $this->_total ;
    }
    
    /**
     * Setter for the total
     *
     * @param double $total The total
     *
     * @return double
     */
    public function setTotal(/*double*/ $total)
    {
    	$this->_total = $total ;
    }
    
    /**
     * Getter for the item name
     *
     * @return string
     */
    public function getItemName()
    {
    	return $this->_itemName ;
    }
    
    /**
     * Setter for the item name
     *
     * @param string $itemName The item name
     *
     * @return void
     */
    public function setItemName(/*string*/ $itemName)
    {
    	$this->_itemName = $itemName ;
    }
    
    /**
     * Getter for the item details
     *
     * @return string
     */
    public function getItemDetails()
    {
        return $this->_itemDetails ;
    }
    
    /**
     * Setter for the item details
     *
     * @param string $itemName The item details
     *
     * @return void
     */
    public function setItemDetails(/*string*/ $itemDetails)
    {
        $this->_itemDetails = $itemDetails ;
    }
    
    /**
     * Getter for the item subtext
     *
     * @return string
     */
    public function getItemSubtext()
    {
    	return $this->_itemSubtext ;
    }
    
    /**
     * Setter for the item subtext
     *
     * @param string $itemSubtext The item name
     *
     * @return void
     */
    public function setItemSubtext(/*string*/ $itemSubtext)
    {
    	$this->_itemSubtext = $itemSubtext ;
    }
    
    /**
     * Getter for the taxes
     *
     * @return OrderItemLinkTax[]
     */
    public function getTaxes()
    {
    	return $this->_taxes ;
    }
    
    /**
     * Setter for the taxes
     *
     * @param OrderItemLinkTax[] $taxes The taxes
     *
     * @return void
     */
    public function setTaxes(/*OrderItemLinkTax[]*/ $taxes)
    {
    	$this->_taxes = $taxes ;
    }
    
    /**
     * Add a tax
     *
     * @param OrderItemLinkTax $tax The tax
     *
     * @return void
     */
    public function addTax(/*OrderItemLinkTax*/ $tax)
    {
    	if (is_null($this->_taxes)) {
    	    $this->_taxes = array();
    	}
        $this->_taxes[] = $tax ;
    }
    
    /**
     * Shows the OrderItemLink as a string
     *
     * @see Object::toString()
     *
     * @return string
     */
    public function toString()
    {
        return '' ;
    }

}
